export const COMMON_ERROR_CODE = 500
export const PARAM_ERROR_CODE = 501
export const LOGIN_ERROR_CODE = 502


/**
 * 通用异常类
 */
export class HandleException extends Error {
    constructor(code = COMMON_ERROR_CODE, msg = '服务器错误！') {
        super();
        this.code = code
        this.msg = msg
    }
}

/**
 * 参数异常类
 */
export class ParamException extends HandleException {
    constructor(msg = '参数错误.') {
        super(PARAM_ERROR_CODE, msg);
    }
}

export class LoginException extends HandleException{
    constructor(msg = '登录失败.') {
        super(LOGIN_ERROR_CODE, msg);
    }
}
